#@adminLayout()
#define main()
<div class="jbolt_page" data-key="#(pmkey)">
<div class="jbolt_page_title">
	<div class="row">
	<div class="col-auto">
	<h1>商品管理</h1>
		<input type="hidden" id="goods_totalPage" value="#(pageData.totalPage)"/>
		<input type="hidden" id="goods_pageNumber" value="#(pageData.pageNumber)"/>
<!-- jstree组件加载数据 -->
<div id="goodsBackCategoryTree_goodsmgr" class="jbolt_input_layer_content"
data-jstree
data-read-url="admin/mall/goodsbackcategory/goodsFilterTree/#(bcategoryId?? 0)"
data-change-handler="changeBackCategory"
></div>
	</div>
	<div class="col text-center">
		<form class="form-inline" id="mallgoodsForm" action="admin/mall/goods"  data-pjaxsubmit  method="get">
		<label class="col-form-label d-inline-block">分类:</label>
		<input type="text" style="width:130px"  autocomplete="off" name="bcategoryName" value="#(bcategoryName?? '=选择分类=')"  class="form-control"  placeholder="=选择分类=" data-load-type="html" data-content-id="goodsBackCategoryTree_goodsmgr"  data-jboltinput data-width="300"/>
		<input type="hidden" name="bcategoryId" value="#(bcategoryId?? 0)"/>
		<input type="hidden" name="fcategoryId" value="#(fcategoryId?? 0)"/>
			<input type="hidden" name="isDelete" value="#(isDelete?? false)"/>
			<input type="text" autocomplete="off"  class="form-control" style="width:130px"  placeholder="输入关键字搜索" name="keywords" value="#(keywords??)" />
			<select class="form-control ml-1"  data-url="admin/mall/goods/onSaleOptions"  name="onSale" data-autoload data-text="=上下架=" data-value="" data-select="#(onSale??)"></select>
			<select class="form-control ml-1"  data-url="admin/mall/goods/isHotOptions"  name="isHot" data-autoload data-text="=热销=" data-value="" data-select="#(isHot??)"></select>
			<select class="form-control ml-1"  data-url="admin/mall/goods/isRecommendOptions"  name="isRecommend" data-autoload data-text="=推荐=" data-value="" data-select="#(isRecommend??)"></select>
			<button  type="button"  onclick="normalData()" class="btn btn-light" ><i class="fa fa-search"></i> 查询</button>
			<button  type="button" onclick="trashData()" class="btn btn-#((isDelete?? && isDelete=="true")?'danger':'light')" ><i class="fa fa-trash"></i> 回收站(#(deleteCount?? 0))</button>
		</form>
	</div>
	<div class="col-auto">
	#setLocal(JboltWithTabs=CACHE.getUserJBoltAdminWithTabs(session[SessionKey.ADMIN_USER_ID]))
	<a #if(JboltWithTabs) data-tabtrigger #else data-pjax #end data-key="mall_goods_preadd" href="admin/mall/goods/preadd" data-title="添加新商品" class="pull-right btn btn-success mr-1" style="width:70px;" ><i class="fa fa-plus"></i> 添加</a>
	</div>
	</div>
</div>
<div class="jbolt_page_content">
<div class="jbolt_table_view">
<div class="jbolt_table_box">
<div class="jbolt_table_body">
<table class="jbolt_table table_striped thead_font_normal table-center tbody_lh20" 
data-jbolttable
data-column-resize="true"
data-height="fill"
data-fixed-columns-left="1,2"
data-fixed-columns-right="11"
>
<thead>
<tr><th data-width="70" data-column="index">序号</th><th data-width="300" data-nochange>商品</th><th data-width="120"  data-nochange>主图</th><th data-min-width="200">营销语</th><th data-width="120"  data-nochange>价格(元)</th><th  data-width="120"  data-nochange>销量</th><th  data-width="80"  data-nochange>上下架</th><th  data-width="80"  data-nochange>热销</th><th data-width="80"  data-nochange>推荐</th><th data-width="200"  data-nochange>时间</th><th  data-width="80"  data-nochange>操作</th></tr>
</thead>
<tbody>
#for(data:pageData.list??)
<tr>
<td>#rownum(for.count,pageData.pageNumber,pageData.pageSize)</td>
<td>
<p class="text-wrap text-left overflow-auto" style="max-height: 80px;">#(data.name??)</p>
</td>
<td><img class="j_goodslist_mainimg"  data-photobtn tooltip data-title="点击查看大图"  src="#realImage(data.mainImage??,'/assets/img/uploadimg.png')" onerror="this.src='assets/img/uploadimg.png'"/></td>
<td>
<p class="text-wrap text-left text-danger overflow-auto" style="max-height: 80px;">[#(data.subTitle?? '未设置')]</p>
</td>

<td><div class="text-left"><span class="d-block text-primary">单价：</span><span class="d-block text-primary"><i class="fa fa-rmb mr-1"></i>#(data.price?? 0)元</span><hr class="my-1"/><span class="d-block text-info">原价：</span><span class="d-block text-info"><i class="fa fa-rmb mr-1"></i>#(data.originalPrice?? 0)元</span></div></td>
<td><div class="text-left"><span class="d-block text-primary">真实：</span><span class="d-block text-primary">#(data.realSaleCount?? 0)#(CACHE.getDictionaryName(data.goodsUnit??))</span><hr class="my-1"/><span class="d-block text-info">营销：</span><span class="d-block text-info">#(data.showSaleCount?? 0)#(CACHE.getDictionaryName(data.goodsUnit??))</span></div></td>



<td>
<img data-switchbtn data-value="#(data.onSale?? false)" data-confirm="确认切换商品上下架状态？"  data-handler="onSaleChangeHandler"  data-url="admin/mall/goods/toggleOnSale/#(data.id)"/>
</td>
<td>
<img data-switchbtn data-value="#(data.isHot?? false)" data-url="admin/mall/goods/toggleIsHot/#(data.id)"/>
</td>
<td>
<img data-switchbtn data-value="#(data.isRecommend?? false)"   data-url="admin/mall/goods/toggleIsRecommend/#(data.id)"/>
</td>
<td>
<div class="text-left">
<span class="d-block text-primary mr-1" tooltip data-title="操作人：[#(CACHE.getUserName(data.createUserId))]">创建:[<i class="fa fa-clock mr-1"></i>#date(data.createTime??,"yyyy/MM/dd HH:mm")]</span>
<span class="d-block text-info mr-1" tooltip data-title="操作人：[#(CACHE.getUserName(data.updateUserId))]">更新:[<i class="fa fa-clock mr-1"></i>#date(data.updateTime??,"yyyy/MM/dd HH:mm")]</span>
#if(data.onSaleUserId??)
<span class="d-block text-success" tooltip data-title="操作人：[#(CACHE.getUserName(data.underUserId))]">上架:[<i class="fa fa-clock mr-1"></i>#date(data.onSaleTime??,"yyyy/MM/dd HH:mm")]</span>
#else
<span class="d-block text-dark" tooltip data-title="未上架">上架:[<i class="fa fa-meh mr-1"></i>未上架]</span>
#end
#if(data.underUserId??)
<span class="d-block text-danger" tooltip data-title="操作人：[#(CACHE.getUserName(data.underUserId))] ">下架:[<i class="fa fa-clock mr-1"></i>#date(data.underTime??,"yyyy/MM/dd HH:mm")]</span>
#else
<span class="d-block text-dark" tooltip data-title="未操作">下架:[<i class="fa fa-meh-blank mr-1"></i>未操作]</span>
#end
</div>
</td>
<td>
#if(data.isDelete??)
<a  tooltip  title="还原"  href="admin/mall/goods/restore/#(data.id)" data-handler="refreshPjaxContainer" data-confirm="确定恢复此商品？(恢复后的商品移出回收站)" class="jbolt_table_delbtn"><i class="fa fa-mail-reply c-danger"></i></a>
#else
#if(!data.onSale??)
<a  tooltip  title="编辑" data-title="编辑商品[#(data.id)]"  href="admin/mall/goods/edit/#(data.id)"  #if(JboltWithTabs)  data-key="edit_goods_#(data.id)" data-tabtrigger #else data-pjax #end  class="jbolt_table_btn"><i class="fa fa-pencil c-primary"></i></a>
<a  tooltip  title="删除"  href="admin/mall/goods/delete/#(data.id)" data-handler="refreshPjaxContainer" data-confirm="确定删除此商品？(删除后的商品进入回收站)" class="jbolt_table_delbtn"><i class="fa fa-remove c-danger"></i></a>
#end
#end


</td>
</tr>
#end
</tbody>
</table>	
</div>
</div>
#include("/_view/_admin/common/_page.html",pageEleId="mallgoodsPage")
</div>

</div>
</div>
#end
#define js()
<script type="text/javascript">
/**
 * 商品管理 后台页面 JS
 */
var mallgoodsForm=$("#mallgoodsForm");
/**
 * 按分类查询
 */
function changeBackCategory(tree,treeNode){
	mallgoodsForm.find("[name='bcategoryId']").val(treeNode.id);
	mallgoodsForm.find("[name='bcategoryName']").val(treeNode.text);
	mallgoodsForm.submit();
}
/**
 * 普通查询
 */
function normalData(){
	mallgoodsForm.find("[name='isDelete']").val(false);
	mallgoodsForm.submit();
}
/**
 * 查回收站
 */
function trashData(){
	mallgoodsForm.find("[name='isDelete']").val(true);
	mallgoodsForm.submit();
}
/**
 * 处理上下架切换后的事项
 */
function onSaleChangeHandler(){
	//var onSale="#(onSale??)";
	//if(onSale!=""){
		refreshPjaxContainer();
	//	}
	
}


$(function(){
	var totalPage=$("#goods_totalPage").val();
	var pageNumber=$("#goods_pageNumber").val();
	initPage("mallgoodsPage",totalPage,pageNumber,"mallgoodsForm");
});
  </script>
  
#end

